package com.ewzj.bigdata.mvp.model

import com.ewzj.bigdata.app.config.netmodel.CommonService
import com.ewzj.bigdata.app.extensions.json2Body
import com.ewzj.bigdata.app.utils.Apputils
import com.ewzj.bigdata.mvp.contract.MainContract
import com.ewzj.bigdata.mvp.model.reqbean.ReqSearchCityBean
import com.ewzj.bigdata.mvp.model.rspbean.BaseData
import com.ewzj.bigdata.mvp.model.rspbean.CitySearchBean
import com.google.gson.Gson
import com.jess.arms.integration.IRepositoryManager
import com.jess.arms.mvp.BaseModel
import io.reactivex.Observable
import javax.inject.Inject

/**
 * author:zhangjing
 * 作用:
 * return:
 */

class MainModel @Inject constructor(val mGson : Gson, repositoryManager: IRepositoryManager):BaseModel(repositoryManager),MainContract.Model{
    val service=repositoryManager.obtainRetrofitService(CommonService::class.java)
    override fun getCityByname(city: String): Observable<BaseData<CitySearchBean>> {
        val reqcitysearch=ReqSearchCityBean(city)
        return service.getcitybyname(json2Body(mGson.toJson(reqcitysearch)))
    }

}